package com.siqi.hr.system.common.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 过滤条件公共类
 */
public class FilterConditionUtil{

	/**
	 * 获取过滤条件
	 * @param queryName
	 * @return
     */
	public static List<Map<String, Object>> getConditionList(String queryName) {
		List<Map<String, Object>> conList = new ArrayList<Map<String, Object>>();
		Map<String, Object> condMap = null;
		if (queryName.endsWith("_date") || queryName.endsWith("_timestamp") || queryName.endsWith("_datetime")) {
			condMap = new HashMap<String, Object>();
			condMap.put("key", "gt");
			condMap.put("value", "晚于");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "lt");
			condMap.put("value", "早于");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "between");
			condMap.put("value", "区间");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "isnull");
			condMap.put("value", "为空");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "notnull");
			condMap.put("value", "不为空");
			conList.add(condMap);
		}else if(queryName.endsWith("_bit")){
			condMap = new HashMap<String, Object>();
			condMap.put("key", "eq");
			condMap.put("value", "等于");
			conList.add(condMap);
		}else if(queryName.endsWith("_radio") || queryName.endsWith("_singlebox")){
			condMap = new HashMap<String, Object>();
			condMap.put("key", "eq");
			condMap.put("value", "=");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "noteq");
			condMap.put("value", "!=");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "isnull");
			condMap.put("value", "为空");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "notnull");
			condMap.put("value", "不为空");
			conList.add(condMap);
		}else if(queryName.endsWith("_mutibox")){
			condMap = new HashMap<String, Object>();
			condMap.put("key", "eq");
			condMap.put("value", "=");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "noteq");
			condMap.put("value", "!=");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "isnull");
			condMap.put("value", "为空");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "notnull");
			condMap.put("value", "不为空");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "include");
			condMap.put("value", "包含");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "notinclude");
			condMap.put("value", "不包含");
			conList.add(condMap);
		}else if(queryName.endsWith("_int") || queryName.endsWith("_long") || queryName.endsWith("_decimal") || queryName.endsWith("_precent") || queryName.endsWith("_currency")){
			condMap = new HashMap<String, Object>();
			condMap.put("key", "between");
			condMap.put("value", "区间");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "gt");
			condMap.put("value", ">");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "ge");
			condMap.put("value", ">=");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "lt");
			condMap.put("value", "<");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "le");
			condMap.put("value", "<=");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "eq");
			condMap.put("value", "=");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "noteq");
			condMap.put("value", "!=");
			conList.add(condMap);
		}else{
			condMap = new HashMap<String, Object>();
			condMap.put("key", "include");
			condMap.put("value", "包含");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "notinclude");
			condMap.put("value", "不包含");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "beginwith");
			condMap.put("value", "开头是");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "endwith");
			condMap.put("value", "结尾是");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "isnull");
			condMap.put("value", "为空");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "notnull");
			condMap.put("value", "不为空");
			conList.add(condMap);

			condMap = new HashMap<String, Object>();
			condMap.put("key", "eq");
			condMap.put("value", "等于");
			conList.add(condMap);
		}
		return conList;
	}
}